<?php
/**
 * All groups listing page navigation
 *
 * @uses $vars['selected'] Name of the tab that has been selected
 */
$tabs = array(
    'newest' => array(
        'text' => elgg_echo('groups:newest'),
        'href' => 'groups/all?filter=newest',
        'priority' => 200
    ),
    'popular' => array(
        'text' => elgg_echo('groups:popular'),
        'href' => 'groups/all?filter=popular',
        'priority' => 300
    ),
// 		'discussion' => array (
// 				'text' => elgg_echo ( 'groups:latestdiscussion' ),
// 				'href' => 'groups/all?filter=discussion',
// 				'priority' => 400 
// 		),
    'subject' => array(
        'text' => elgg_echo('Môn học'),
        'href' => 'groups/all?filter=subject',
        'priority' => 500
    ),
    'project' => array(
        'text' => elgg_echo('Nhóm thực hiện đề tài'),
        'href' => 'groups/all?filter=project',
        'priority' => 600
    ),
);



$user = elgg_get_logged_in_user_entity();
if ($user->usertype == "Teacher"){
    $project_teacher = array('project_teacher' => array(
        'text' => elgg_echo('Nhóm đang hướng dẫn'),
        'href' => 'groups/all?filter=project_teacher',
        'priority' => 100
    ));
    $tabs = array_merge($tabs, $project_teacher);
}

if ($user->usertype == "Teacher"){
    $project_teacher = array('review_teacher_make' => array(
        'text' => elgg_echo('Các đánh giá của tôi'),
        'href' => 'groups/all?filter=review_teacher_make',
        'priority' => 800
    ));
    $tabs = array_merge($tabs, $project_teacher);
}

foreach ($tabs as $name => $tab) {
    $tab ['name'] = $name;

    if ($vars ['selected'] == $name) {
        $tab ['selected'] = true;
    }

    elgg_register_menu_item('filter', $tab);
}

echo elgg_view_menu('filter', array(
    'sort_by' => 'priority',
    'class' => 'elgg-menu-hz'
));
